PDF

您所在的位置:网站首页 alpha logo PDF

PDF

#PDF| 来源: 网络整理| 查看: 265

#ifndef MUPDF_FITZ_PIXMAP_H #define MUPDF_FITZ_PIXMAP_H

#include “mupdf/fitz/system.h” #include “mupdf/fitz/context.h” #include “mupdf/fitz/geometry.h” #include “mupdf/fitz/store.h” #include “mupdf/fitz/separation.h”

/** Pixmaps represent a set of pixels for a 2 dimensional region of a plane. Each pixel has n components per pixel. The components are in the order process-components, spot-colors, alpha, where there can be 0 of any of those types. The data is in premultiplied alpha when rendering, but non-premultiplied for colorspace conversions and rescaling. 像素图表示二维区域的一组像素 一架飞机。 每个像素每个像素有 n 个分量。 组件 顺序是流程组件、专色、alpha,其中 这些类型中的任何一种都可以是 0。 数据在 渲染时预乘 alpha,但未预乘 色彩空间转换和重新缩放。 */

typedef struct fz_overprint fz_overprint;

/** Return the bounding box for a pixmap. 返回像素图的边界框。 */ fz_irect fz_pixmap_bbox(fz_context *ctx, const fz_pixmap *pix);

/** Return the width of the pixmap in pixels. 以像素为单位返回像素图的宽度。 */ int fz_pixmap_width(fz_context *ctx, const fz_pixmap *pix);

/** Return the height of the pixmap in pixels. 以像素为单位返回像素图的高度。 */ int fz_pixmap_height(fz_context *ctx, const fz_pixmap *pix);

/** Return the x value of the pixmap in pixels. 以像素为单位返回像素图的 x 值。 */ int fz_pixmap_x(fz_context *ctx, const fz_pixmap *pix);

/** Return the y value of the pixmap in pixels. 以像素为单位返回像素图的 y 值。 */ int fz_pixmap_y(fz_context *ctx, const fz_pixmap *pix);

/** Create a new pixmap, with its origin at (0,0)

cs: The colorspace to use for the pixmap, or NULL for an alpha plane/mask. w: The width of the pixmap (in pixels) h: The height of the pixmap (in pixels) seps: Details of separations. alpha: 0 for no alpha, 1 for alpha. Returns a pointer to the new pixmap. Throws exception on failure to allocate. 创建一个新的像素图,其原点为 (0,0) cs:用于像素图的色彩空间,或 NULL 用于 alpha 飞机/面具。 w:像素图的宽度(以像素为单位) h:像素图的高度(以像素为单位) seps:分离细节。 alpha:0 表示没有 alpha,1 表示 alpha。 返回指向新像素图的指针。 失败时抛出异常 分配。

*/ fz_pixmap *fz_new_pixmap(fz_context *ctx, fz_colorspace *cs, int w, int h, fz_separations *seps, int alpha);

/** Create a pixmap of a given size, location and pixel format.

The bounding box specifies the size of the created pixmap and where it will be located. The colorspace determines the number of components per pixel. Alpha is always present. Pixmaps are reference counted, so drop references using fz_drop_pixmap. colorspace: Colorspace format used for the created pixmap. The pixmap will keep a reference to the colorspace. bbox: Bounding box specifying location/size of created pixmap. seps: Details of separations. alpha: 0 for no alpha, 1 for alpha. Returns a pointer to the new pixmap. Throws exception on failure to allocate. 创建给定大小、位置和像素格式的像素图。 边界框指定创建的像素图的大小和 它将位于何处。 色彩空间决定数量 每个像素的组件数。 阿尔法永远存在。 像素图是 引用计数,因此使用 fz_drop_pixmap 删除引用。 颜色空间:用于创建的像素图的颜色空间格式。 这 pixmap 将保留对颜色空间的引用。 bbox:指定创建像素图的位置/大小的边界框。 seps:分离细节。 alpha:0 表示没有 alpha,1 表示 alpha。 返回指向新像素图的指针。 失败时抛出异常 分配。

*/ fz_pixmap *fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, fz_irect bbox, fz_separations *seps, int alpha);

/** Create a new pixmap, with its origin at (0,0) using the supplied data block.

cs: The colorspace to use for the pixmap, or NULL for an alpha plane/mask. w: The width of the pixmap (in pixels) h: The height of the pixmap (in pixels) seps: Details of separations. alpha: 0 for no alpha, 1 for alpha. stride: The byte offset from the pixel data in a row to the pixel data in the next row. samples: The data block to keep the samples in. Returns a pointer to the new pixmap. Throws exception on failure to allocate. 创建一个新的像素图,其原点为 (0,0) 使用提供的数据块。 cs:用于像素图的色彩空间,或 NULL 用于 alpha 飞机/面具。 w:像素图的宽度(以像素为单位) h:像素图的高度(以像素为单位) seps:分离细节。 alpha:0 表示没有 alpha,1 表示 alpha。 stride:从一行中的像素数据到该行的字节偏移量 下一行的像素数据。 样本:保存样本的数据块。 返回指向新像素图的指针。 失败时抛出异常 分配。

*/ fz_pixmap *fz_new_pixmap_with_data(fz_context *ctx, fz_colorspace *colorspace, int w, int h, fz_separations *seps, int alpha, int stride, unsigned char *samples);

/** Create a pixmap of a given size, location and pixel format, using the supplied data block.

The bounding box specifies the size of the created pixmap and where it will be located. The colorspace determines the number of components per pixel. Alpha is always present. Pixmaps are reference counted, so drop references using fz_drop_pixmap. colorspace: Colorspace format used for the created pixmap. The pixmap will keep a reference to the colorspace. rect: Bounding box specifying location/size of created pixmap. seps: Details of separations. alpha: Number of alpha planes (0 or 1). samples: The data block to keep the samples in. Returns a pointer to the new pixmap. Throws exception on failure to allocate. 创建给定大小、位置和像素格式的像素图, 使用提供的数据块。 边界框指定创建的像素图的大小和 它将位于何处。 色彩空间决定数量 每个像素的组件数。 阿尔法永远存在。 像素图是 引用计数,因此使用 fz_drop_pixmap 删除引用。 颜色空间:用于创建的像素图的颜色空间格式。 这 pixmap 将保留对颜色空间的引用。 rect:指定创建像素图的位置/大小的边界框。 seps:分离细节。 alpha:alpha 平面的数量(0 或 1)。 样本:保存样本的数据块。 返回指向新像素图的指针。 失败时抛出异常 分配。

*/ fz_pixmap *fz_new_pixmap_with_bbox_and_data(fz_context *ctx, fz_colorspace *colorspace, fz_irect rect, fz_separations *seps, int alpha, unsigned char *samples);

/** Create a new pixmap that represents a subarea of the specified pixmap. A reference is taken to this pixmap that will be dropped on destruction.

The supplied rectangle must be wholly contained within the original pixmap. Returns a pointer to the new pixmap. Throws exception on failure to allocate. 创建一个表示指定子区域的新像素图 像素图。 引用将被删除的此像素图 关于破坏。 提供的矩形必须完全包含在 原始像素图。 返回指向新像素图的指针。 失败时抛出异常 分配。

*/ fz_pixmap *fz_new_pixmap_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, const fz_irect *rect);

/** Clone a pixmap, copying the pixels and associated data to new storage.

The reference count of 'old' is unchanged. 克隆一个像素图,将像素和相关数据复制到新的 贮存。 'old' 的引用计数不变。

*/ fz_pixmap *fz_clone_pixmap(fz_context *ctx, const fz_pixmap *old);

/** Increment the reference count for the pixmap. The same pointer is returned.

Never throws exceptions. 增加像素图的引用计数。 同一个指针 被退回。 从不抛出异常。

*/ fz_pixmap *fz_keep_pixmap(fz_context *ctx, fz_pixmap *pix);

/** Decrement the reference count for the pixmap. When the reference count hits 0, the pixmap is freed.

Never throws exceptions. 减少像素图的引用计数。 当。。。的时候 引用计数达到 0,像素图被释放。 从不抛出异常。

*/ void fz_drop_pixmap(fz_context *ctx, fz_pixmap *pix);

/** Return the colorspace of a pixmap

Returns colorspace. 返回像素图的色彩空间 返回色彩空间。

*/ fz_colorspace *fz_pixmap_colorspace(fz_context *ctx, const fz_pixmap *pix);

/** Return the number of components in a pixmap.

Returns the number of components (including spots and alpha). 返回像素图中的组件数。 返回组件的数量(包括点和 alpha)。

*/ int fz_pixmap_components(fz_context *ctx, const fz_pixmap *pix);

/** Return the number of colorants in a pixmap.

Returns the number of colorants (components, less any spots and alpha). 返回像素图中的着色剂数量。 返回着色剂的数量(成分,减去任何斑点和α)。

*/ int fz_pixmap_colorants(fz_context *ctx, const fz_pixmap *pix);

/** Return the number of spots in a pixmap.

Returns the number of spots (components, less colorants and alpha). Does not throw exceptions. 返回像素图中的点数。 返回点数(组分、较少的着色剂和α)。 不抛出异常。

*/ int fz_pixmap_spots(fz_context *ctx, const fz_pixmap *pix);

/** Return the number of alpha planes in a pixmap.

Returns the number of alphas. Does not throw exceptions. 返回像素图中的 alpha 平面数。 返回 alpha 的数量。 不抛出异常。

*/ int fz_pixmap_alpha(fz_context *ctx, const fz_pixmap *pix);

/** Returns a pointer to the pixel data of a pixmap.

Returns the pointer. 返回指向像素图像素数据的指针。 返回指针。

*/ unsigned char *fz_pixmap_samples(fz_context *ctx, const fz_pixmap *pix);

/** Return the number of bytes in a row in the pixmap. 返回像素图中一行中的字节数。 */ int fz_pixmap_stride(fz_context *ctx, const fz_pixmap *pix);

/** Set the pixels per inch resolution of the pixmap. 设置像素图的每英寸像素分辨率。 */ void fz_set_pixmap_resolution(fz_context *ctx, fz_pixmap *pix, int xres, int yres);

/** Clears a pixmap with the given value.

pix: The pixmap to clear. value: Values in the range 0 to 255 are valid. Each component sample for each pixel in the pixmap will be set to this value, while alpha will always be set to 255 (non-transparent). This function is horrible, and should be removed from the API and replaced with a less magic one. 清除具有给定值的像素图。 pix:要清除的像素图。 value:0 到 255 范围内的值是有效的。 每个组件 像素图中每个像素的样本将设置为该值, 而 alpha 将始终设置为 255(非透明)。 这个功能太可怕了,应该从 API 并替换为一个不那么神奇的 API。

*/ void fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value);

/** Fill pixmap with solid color. 用纯色填充像素图。 */ void fz_fill_pixmap_with_color(fz_context *ctx, fz_pixmap *pix, fz_colorspace *colorspace, float *color, fz_color_params color_params);

/** Clears a subrect of a pixmap with the given value.

pix: The pixmap to clear. value: Values in the range 0 to 255 are valid. Each component sample for each pixel in the pixmap will be set to this value, while alpha will always be set to 255 (non-transparent). r: the rectangle. 清除具有给定值的像素图的子区域。 pix:要清除的像素图。 value:0 到 255 范围内的值是有效的。 每个组件 像素图中每个像素的样本将设置为该值, 而 alpha 将始终设置为 255(非透明)。 r:矩形。

*/ void fz_clear_pixmap_rect_with_value(fz_context *ctx, fz_pixmap *pix, int value, fz_irect r);

/** Sets all components (including alpha) of all pixels in a pixmap to 0.

pix: The pixmap to clear. 设置所有组件(包括 alpha) 像素图中的所有像素都为 0。 pix:要清除的像素图。

*/ void fz_clear_pixmap(fz_context *ctx, fz_pixmap *pix);

/** Invert all the pixels in a pixmap. All components (process and spots) of all pixels are inverted (except alpha, which is unchanged). 反转像素图中的所有像素。 所有组件(过程和 点)的所有像素都被反转(除了 alpha,它是 不变)。 */ void fz_invert_pixmap(fz_context *ctx, fz_pixmap *pix);

/** Transform the pixels in a pixmap so that luminance of each pixel is inverted, and the chrominance remains unchanged (as much as accuracy allows).

All components of all pixels are inverted (except alpha, which is unchanged). Only supports Grey and RGB bitmaps. 变换像素图中的像素,使每个像素的亮度 像素被反转,色度保持不变(如 在精度允许的情况下)。 所有像素的所有分量都被反转(除了 alpha,它 不变)。 仅支持灰色和 RGB 位图。

*/ void fz_invert_pixmap_luminance(fz_context *ctx, fz_pixmap *pix);

/** Tint all the pixels in an RGB, BGR, or Gray pixmap.

black: Map black to this hexadecimal RGB color. white: Map white to this hexadecimal RGB color. 为 RGB、BGR 或灰色像素图中的所有像素着色。 黑色:将黑色映射到此十六进制 RGB 颜色。 白色:将白色映射到此十六进制 RGB 颜色。

*/ void fz_tint_pixmap(fz_context *ctx, fz_pixmap *pix, int black, int white);

/** Invert all the pixels in a given rectangle of a pixmap. All components of all pixels in the rectangle are inverted (except alpha, which is unchanged). 反转给定矩形中的所有像素 像素图。 矩形中所有像素的所有分量都是 反转(除了 alpha,它没有变化)。 */ void fz_invert_pixmap_rect(fz_context *ctx, fz_pixmap *image, fz_irect rect);

/** Apply gamma correction to a pixmap. All components of all pixels are modified (except alpha, which is unchanged).

gamma: The gamma value to apply; 1.0 for no change. 对像素图应用伽马校正。 所有组件 的所有像素都被修改(除了 alpha,它没有变化)。 伽马:要应用的伽马值; 1.0 不变。

*/ void fz_gamma_pixmap(fz_context *ctx, fz_pixmap *pix, float gamma);

/** Convert an existing pixmap to a desired colorspace. Other properties of the pixmap, such as resolution and position are copied to the converted pixmap.

pix: The pixmap to convert. default_cs: If NULL pix->colorspace is used. It is possible that the data may need to be interpreted as one of the color spaces in default_cs. cs_des: Desired colorspace, may be NULL to denote alpha-only. prf: Proofing color space through which we need to convert. color_params: Parameters that may be used in conversion (e.g. ri). keep_alpha: If 0 any alpha component is removed, otherwise alpha is kept if present in the pixmap. 将现有像素图转换为所需的 色彩空间。 像素图的其他属性,例如分辨率 和位置被复制到转换后的像素图。 pix:要转换的像素图。 default_cs:如果使用 NULL pix->colorspace。 它可能是 数据可能需要被解释为颜色空间之一 在 default_cs 中。 cs_des:所需的色彩空间,可以为 NULL 以表示仅 alpha。 prf:我们需要转换的校样色彩空间。 color_params:转换中可能使用的参数(例如 里)。 keep_alpha:如果为 0,则删除任何 alpha 分量,否则 如果存在于像素图中,则保留 alpha。

*/ fz_pixmap *fz_convert_pixmap(fz_context *ctx, const fz_pixmap *pix, fz_colorspace *cs_des, fz_colorspace *prf, fz_default_colorspaces *default_cs, fz_color_params color_params, int keep_alpha);

/** Check if the pixmap is a 1-channel image containing samples with only values 0 and 255 检查像素图是否是包含样本的 1 通道图像仅值 0 和 255 */ int fz_is_pixmap_monochrome(fz_context *ctx, fz_pixmap *pixmap);

/* Implementation details: subject to change. 实施细节:可能会发生变化 */

fz_pixmap *fz_alpha_from_gray(fz_context *ctx, fz_pixmap *gray); void fz_decode_tile(fz_context *ctx, fz_pixmap *pix, const float *decode); void fz_md5_pixmap(fz_context *ctx, fz_pixmap *pixmap, unsigned char digest[16]);

fz_stream * fz_unpack_stream(fz_context *ctx, fz_stream *src, int depth, int w, int h, int n, int indexed, int pad, int skip);

/** Pixmaps represent a set of pixels for a 2 dimensional region of a plane. Each pixel has n components per pixel. The components are in the order process-components, spot-colors, alpha, where there can be 0 of any of those types. The data is in premultiplied alpha when rendering, but non-premultiplied for colorspace conversions and rescaling.

x, y: The minimum x and y coord of the region in pixels. w, h: The width and height of the region in pixels. n: The number of color components in the image. n = num composite colors + num spots + num alphas s: The number of spot channels in the image. alpha: 0 for no alpha, 1 for alpha present. flags: flag bits. Bit 0: If set, draw the image with linear interpolation. Bit 1: If set, free the samples buffer when the pixmap is destroyed. stride: The byte offset from the data for any given pixel to the data for the same pixel on the row below. seps: NULL, or a pointer to a separations structure. If NULL, s should be 0. xres, yres: Image resolution in dpi. Default is 96 dpi. colorspace: Pointer to a colorspace object describing the colorspace the pixmap is in. If NULL, the image is a mask. samples: Pointer to the first byte of the pixmap sample data. This is typically a simple block of memory w * h * n bytes of memory in which the components are stored linearly, but with the use of appropriate stride values, scanlines can be stored in different orders, and have different amounts of padding. The first n bytes are components 0 to n-1 for the pixel at (x,y). Each successive n bytes gives another pixel in scanline order as we move across the line. The start of each scanline is offset the start of the previous one by stride bytes. 像素图表示二维区域的一组像素 一架飞机。每个像素每个像素有 n 个分量。组件 顺序是流程组件、专色、alpha,其中 这些类型中的任何一种都可以为 0。数据在 渲染时预乘 alpha,但未预乘 色彩空间转换和重新缩放。 x, y:区域的最小 x 和 y 坐标(以像素为单位)。 w, h:区域的宽度和高度,以像素为单位。 n:图像中颜色分量的数量。 n = num 复合颜色 + num 点 + num alphas s:图像中的专色通道数。 alpha:0 表示没有 alpha,1 表示存在 alpha。 标志:标志位。 位 0:如果设置,则使用线性插值绘制图像。 位 1:如果设置,则在像素映射时释放样本缓冲区 被摧毁。 步幅:任何给定像素的数据的字节偏移量 到下一行相同像素的数据。 seps:NULL,或指向分离结构的指针。如果为空, s 应该是 0。 xres, yres:dpi 中的图像分辨率。默认值为 96 dpi。 颜色空间:指向描述颜色空间对象的指针 像素图所在的颜色空间。如果为 NULL,则图像是遮罩。 样本:指向像素图样本数据的第一个字节的指针。 这通常是一个简单的内存块 w * h * n 字节 线性存储组件的内存,但具有 使用适当的步幅值,扫描线可以存储在 不同的订单,并有不同的填充量。这 前 n 个字节是 (x,y) 处像素的 0 到 n-1 分量。 每个连续的 n 个字节给出另一个按扫描线顺序的像素 当我们越过这条线时。每条扫描线的起点偏移 前一个字节的开始。

*/ struct fz_pixmap { fz_storable storable; int x, y, w, h; unsigned char n; unsigned char s; unsigned char alpha; unsigned char flags; ptrdiff_t stride; fz_separations *seps; int xres, yres; fz_colorspace *colorspace; unsigned char *samples; fz_pixmap *underlying; };

enum { FZ_PIXMAP_FLAG_INTERPOLATE = 1, FZ_PIXMAP_FLAG_FREE_SAMPLES = 2 };

/* Create a new pixmap from a warped section of another. *

Colorspace, resolution etc are inherited from the original.

points give the corner points within the original pixmap of a

(convex) quadrilateral. These corner points will be ‘warped’ to be

the corner points of the returned bitmap, which will have the given

width/height. 从另一个扭曲的部分创建一个新的像素图。

色彩空间、分辨率等均继承自原版。 点给出了原始像素图中的角点 (凸)四边形。 这些角点将被“扭曲”为 返回位图的角点,将具有给定的 宽度/高度。 */ fz_pixmap * fz_warp_pixmap(fz_context *ctx, fz_pixmap *src, const fz_point points[4], int width, int height);

#endif



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3